<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
{{assign var="title" value='附件'}}
{{assign var="app" value='photo'}}
{{assign var="act" value='insert'}}
{{assign var="table" value='photo'}}
{{assign var="uploadPlug" value='plupload'}}
<title>{{$title}}管理 - {{'admin|admin_site_name'|C|default:'后台管理'}}</title>
{{include file="include/base.html"}}
{{include file="{{$smarty.const.PLUG}}editable/editable.html"}}
{{include file="{{$smarty.const.PLUG}}115box/115box.html"}}
<style>
.body_right #quickmenu{padding:5px 15px;}
.body_right>#content{padding:5px;}
.body_right{top:0 !important;}
</style>
</head>
<body>

	<div class="body_right">
		<div id="content">
			<dl class="dbox">
		        <dt class="lside">
		            <div class="floatr">
		                <a class="btn" href="javascript:document.location.reload();"><i class="icon-refresh"></i>【刷新】</a>
		                <a class="btn iframe" width="650px" height="320px" title="上传文件" href="index.php?app=photo&act={{$uploadPlug}}&item={{$smarty.get.item}}{{if $smarty.get.ext}}&ext={{$smarty.get.ext}}{{/if}}{{if $smarty.get.maxsize}}&maxsize={{$smarty.get.maxsize}}{{/if}}&iframe=true"><i class="icon-eject"></i>【上传文件】</a>
		            </div>
					{{$catname}}
					<span style="padding-left:10px;font-weight:normal;color:turquoise;">（温馨提示：双击可选择文件）</span>
		        </dt>
		        <dd>
		            <div id="quickmenu">
						{{if !$result}}{{*是否有显示结果 S*}}
						<div class="result_empty" style="min-height:430px;"></div>
						{{else}}
						<div class="listthumb" style="min-height:390px;">
						<ul>
						{{foreach from=$result item=val}}
							<li class="">
								<div class="file-thumb photo-box">
									<div class="boxout">
										<div class="boxin">
											<a title="双击选择" href="javascript:">
												<img src="{{$smarty.const.__PUB__}}share/images/ext/{{$val.params.ext}}.png" lang="{{$val.link}}" class="insert_img"/>
											</a>
										</div>
									</div>
								</div>
								<div class="file-name"> 
									<a href="javascript:" class="editable" data="{{'table='|cat:$table|cat:'&field=title&id='|cat:$val.id|encode}}" title="{{$val.title|default:"暂无描述"}}">{{$val.title|default:"暂无描述"}}</a>
								</div>
								<div class="file-info">选择文件</div>
								<div class="file-opt">
									<a href="{{$smarty.const.__PUB__}}{{$val.link}}" target="_blank" class="i-preview confirm" title="确定要下载吗?"><i class="icon-cloud-download"></i></a>
									<a link="index.php?app=photo&act=delete&id={{$val.id}}" class="ajaxSubmit confirm refresh i-delete" title="删除将不可恢复,确定要删除吗?"><i class="icon-trash"></i></a>
								</div>
							</li>
						{{/foreach}}
						</ul>
						<div class="clear"></div>
						</div>
						{{/if}}{{*是否有显示结果 E*}}
						<div class="clear"></div>
					</div>
					<script>
						$(document).ready(function(){
							$(".insert_img").dblclick(function(){
								//alert($(this).attr("lang"));
								if("{{$smarty.get.type}}"=="input"){//input输入框
									if('{{$smarty.get.name}}'!='') {//name
										var exp_input = "input[name='{{$smarty.get.name}}']";//for input
										var exp_img = "img[id='{{$smarty.get.name}}_img']";//for img
									}else if('{{$smarty.get.id}}'!='') {//id
										var exp_input = "input#{{$smarty.get.id}}";//for input
										var exp_img = "img[id='{{$smarty.get.id}}_img']";//for img
									}
									$(window.parent.document).find(exp_input).val($(this).attr("lang"));//将路径插入input框
									$(window.parent.document).find(exp_img).attr('src','{{$smarty.const.__PUB__}}'+$(this).attr("lang")); //更新img标签
								}else if("{{$smarty.get.type}}"=="ueditor"){//ueditor
									if('{{$smarty.get.class}}'!=''){
										parent.UE.getEditor('{{$smarty.get.class}}').execCommand('insertHtml', "<img src='{{$smarty.const.__PUB__}}"+($(this).attr("lang"))+"'/>")
									}else{
										parent.UE.getEditor(parent.$('.editor').attr('id')).execCommand('insertHtml', "<img src='{{$smarty.const.__PUB__}}"+($(this).attr("lang"))+"'/>")
									}
								}else if("{{$smarty.get.type}}"=="xheditor"){//xheditor
									if('{{$smarty.get.class}}'!='')
										parent.$('.{{$smarty.get.class}}').xheditor().appendHTML("<img src='{{$smarty.const.__PUB__}}"+($(this).attr("lang"))+"'/>"); //(设置源代码2)
									else
										parent.xheditor.appendHTML("<img src='{{$smarty.const.__PUB__}}"+($(this).attr("lang"))+"'/>"); //(设置源代码2)
								}
								parent.$.fn.colorbox.close();//关闭colorbox
							});
							
						});
					</script>
					{{include file="include/page.html"}}
		        </dd>
			</dl>
		</div>
	</div>

<script>
$(function(){
	$(".boxin img").error(function(){
	   this.src = '{{$smarty.const.__PUB__}}share/images/ext/unknown.png';
	});
});
</script>
</body>
</html>